<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>activiti登录</title>
    <style type="text/css">
        .login-center {
            width: 600px;
            margin-left: auto;
            margin-right: auto;
        }

        #loginContainer {
            margin-top: 3em;
        }

        .login-input {
            padding: 4px 6px;
            font-size: 14px;
            vertical-align: middle;
        }
    </style>
</head>
<script type="text/javascript" src="js/common/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/common/plugins/jui/jquery-ui-1.9.2.min.js"></script>
<script type="text/javascript" src="editor-app/libs/angular_1.2.13/angular.min.js"></script>
<body>

<div id="loginContainer" class="login-center" ng-app="app" ng-controller="loginController" ng-init="init()">
    <div style="text-align: center;">
        <h2>工作流引擎Activiti演示项目</h2>
        <h3>
            <a href="https://github.com/henryyan/kft-activiti-demo" target="_blank" style="text-decoration: none;">kft-activiti-demo（v${prop['system.version']}）</a>
            <a href="http://www.kafeitu.me/about.html" target="_blank" style="text-decoration: none;"></a></h3>
    </div>
    <hr/>
    <table >
        <tr>
            <td width="200" style="text-align: right;">用户名：</td>
            <td><input id="username" name="username" ng-model="user.username" class="login-input" placeholder="用户名"/>
            </td>
        </tr>
        <tr>
            <td style="text-align: right;">密码：</td>
            <td><input id="password" name="password" ng-model="user.password" type="password" class="login-input"
                       placeholder="默认为：000000"/></td>
        </tr>
        <tr>
            <td>&nbsp</td>
            <td>
                <button ng-click="login($scope.user.username,$scope.user.password)">登录Demo</button>
            </td>
        </tr>
    </table>
    <hr/>
    <div>
        <div style="float:right; width: 50%;">
            <dl>
                <dt>《Activiti实战》：</dt>
                <dd><a target="_blank" href="http://www.kafeitu.me/activiti-in-action.html">http://www.kafeitu.me/activiti-in-action.html</a>
                </dd>

                <dt>Wiki：</dt>
                <dd><a target="_blank" href="https://github.com/henryyan/kft-activiti-demo/wiki">https://github.com/henryyan/kft-activiti-demo/wiki</a>
                </dd>

                <dt>Demo源码：</dt>
                <dd><a target="_blank" href="https://github.com/henryyan/kft-activiti-demo">https://github.com/henryyan/kft-activiti-demo</a>
                </dd>

                <dt>Activiti资料：</dt>
                <dd><a target="_blank" href="http://www.kafeitu.me/categories.html#activiti-ref">http://www.kafeitu.me/categories.html#activiti-ref</a>
                </dd>

            </dl>
        </div>
    </div>
    <hr/>
    <div>
        <div style="float:left; width: 50%;">
            <h5>组件版本信息</h5>
            <ul>
                <li>Activiti版本：{{activitiVersion}}</li>
                <li>Springboot版本：{{springbootVersion}}</li>
                <li>Database：{{dbType}}</li>
                <li>使用<a href="http://maven.apache.org" target="_blank">Maven</a>管理依赖</li>
            </ul>
        </div>
        <div style="float:right; width: 50%;">
        </div>
    </div>
    <hr/>
    <div>
        <a href="http://www.kafeitu.me/activiti-in-action.html" target="_blank">
            <img src="images/activiti-in-action.jpg" alt=""></a>
    </div>
</div>
</body>
<script type="text/javascript">
    var app = angular.module('app', []);
    app.controller('loginController', function ($scope, $http) {
        //初始化变量，如果绑定的是对象，需要先初始化
        $scope.user = {
            username: "",
            password: ""
        };
        debugger
        $scope.init = function () {
            $scope.springbootVersion = "1.5.9.RELEASE";
            $scope.activitiVersion = "5.22";
            $scope.dbType = "Mysql 5.6";

        }
        $scope.login = function () {
            //原始方式获取值
            // var pwd= $("#password").val();
            // var uname=$("#username").val();
            var uname = $scope.user.username;
            var pwd = $scope.user.password;
            if ((uname == '' || uname == null) || (pwd == '' || pwd == null)) {
                alert("用户名或者密码不能为空");
            }
            $http.get('user/login?username=' + uname + "&&password=" + pwd).success(function (data) {
                if (data.state != '200') {
                    alert(data.cause);
                    return;
                }
                //登录成功
                debugger
                window.location.href = "welcome.html";
            });
        }
    });
</script>
</html>